package com.blame.ollama.controller;

import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何彦声
 * Date: 2025-08-28
 * Time:
 */

@RequestMapping("/ollama")
@RestController
public class OllamaController {

    @Autowired
    private OllamaChatModel ollamaChatModel;

    @RequestMapping("/Call")
    public String Call(String message){
        return ollamaChatModel.call(message);
    }

    @RequestMapping("/stream")
    public String stream(String message){

        return ollamaChatModel.stream(new Prompt(message)).toString();
    }
}
